import requset from '@/utils'

// 获取分类列表 
export function getCategoryList(params) {
    return requset({
        url: '/categories',
        params
    })
}
// 获取分类数量
export function getCategoryCount(params) {
    return requset({
        url: '/categories/count',
        params
    })
}

// 新增分类
export function addCategory(data) {
    return requset({
        url: '/categories',
        method:"post",
        data
    })
}

// 删除分类
export function delCategory(id){
    return requset({
        url: `/categories/${id}`,
        method:'DELETE'
    })
}

// 获取指定分类
export function getCategoryById(id) {
    return requset({
        url:`/categories/${id}`,
    })
  }

// 编辑分类
export function editCategory(data){
    return requset({
        url: `/categories/${data.id}`,
        method:'PUT',
        data
    })
}